package com.situ.domain.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import org.jetbrains.annotations.NotNull;

import java.util.List;

@Data
@Builder
@Schema(description = "菜单列表")
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode
public class MenuListVO implements Comparable<MenuListVO>{

    @Schema(description = "菜单id")
    private Integer id;

    @Schema(description = "菜单路径")
    private String path;

    @Schema(description = "菜单标题")
    private String title;

    @Schema(description = "菜单图标")
    private String icon;

    @Schema(description = "子菜单")
    private List<Children> children;

    @Override
    public int compareTo(@NotNull MenuListVO o) {
        return this.id - o.getId();
    }

    @Builder
    @Data
    @Schema(description = "子菜单")
    @EqualsAndHashCode
    public static class Children {
        @Schema(description = "子菜单id")
        private Integer id;

        @Schema(description = "子菜单路径")
        private String path;

        @Schema(description = "子菜单标题")
        private String title;

        @Schema(description = "子菜单链接")
        private String linkUrl;

        @Schema(description = "子菜单(冗余字段)")
        private List<Children> children;
    }
}
